package org.phoenix.mall.admin.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.phoenix.mall.admin.common.pojo.vo.RightVO;
import org.phoenix.mall.admin.common.utils.PhoenixResponseJSON;
import org.phoenix.mall.admin.config.annotations.AuthRequired;
import org.phoenix.mall.admin.service.RightService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(value = "菜单管理", tags = {"菜单管理相关API"})
@RestController
@RequestMapping("menus")
@AuthRequired
public class MenuController {

    @Resource
    private RightService rightService;

    @ApiOperation(value = "菜单列表", notes = "获取菜单列表", httpMethod = "GET")
    @GetMapping("")
    public PhoenixResponseJSON list() {
        List<RightVO> list = rightService.getChildRightListByPid(0, 1);
        return PhoenixResponseJSON.ok(list);
    }
}
